﻿using DLog.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DLog.Config
{
    public class StorageConfig
    {
        /// <summary>
        /// by key value get is assembly name
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string GetAssembly(string key)
        {
            string xmlPath = System.AppDomain.CurrentDomain.BaseDirectory + "DLog.config";
            return XMLHelper.xmlDoc(xmlPath).SelectSingleNode("/DLog/DalFactorys/parameter[@key='" + key + "']").Attributes["value"].Value;
        }

        /// <summary>
        /// by key value get is class name
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string GetClassName(string key)
        {
            string xmlPath = System.AppDomain.CurrentDomain.BaseDirectory + "DLog.config";
            return XMLHelper.xmlDoc(xmlPath).SelectSingleNode("/DLog/DalFactorys/parameter[@key='" + key + "']").Attributes["class"].Value;
        }
    }
}
